import networkx as nx

g = nx.Graph()
n1 = g.add_node(1, p1='p1', p2='p2')
n2 = g.add_node(2, p={'name': 'a', 'type': 'b'})
na = g.add_node('a', p={'pp': 'pp'})

e1 = g.add_edge(1, 2, p1='p1')

print('graph: ', g)
print('nodes: ', g.nodes)
print('edges: ', g.edges)
print('node1: ', g.nodes[1])
print('node2: ', g.nodes[2])
print('nodea: ', g.nodes['a'])
print('edge: ', g.edges[1, 2])